package loja.stock.teste;

import static org.junit.Assert.*;
import loja.stock.Armazem;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import BaseDados.BaseDados;

public class ArmazemTest {

	private static BaseDados bd;
	private static Armazem a1, a2, a3, a4;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		bd = new BaseDados();
		a1 = new Armazem(1, "A");
		a2 = new Armazem(12, "AB");
		a3 = new Armazem(3, "C");
		a4 = new Armazem(34, "CD");
		bd.inserirArmazem(a2);
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		System.out.print("END OF TEST");
	}

	@Before
	public void setUp() throws Exception {
		System.out.println("setUp()");
	}

	@After
	public void tearDown() throws Exception {
		System.out.println("tearDown()");
	}

	@Test
	public final void testArmazem() {
		assertTrue(bd.getArmazens().size()>=0);
		assertNotNull(a1);
		Armazem a5 = a1;
		assertSame(a1, a5);

	}

	@Test
	public final void testGetId_armazem() {
		assertTrue(a2.getId_armazem() == 12);
		assertEquals(a1.getId_armazem(), 1);

	}

	@Test
	public final void testGetNome() {
		assertFalse(a4.getNome() == "ABC");
		assertTrue(a3.getNome().charAt(0) == a4.getNome().charAt(0));
	}

}
